package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ActivityContent;
import com.api.shopapi.entity.ActivityItem;
import com.api.shopapi.mapper.ActivityContentMapper;
import com.api.shopapi.service.ActivityContentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ActivityContentServiceImplOne")
public class ActivityContentServiceImpl implements ActivityContentService {


    @Autowired
    private ActivityContentMapper activityContentMapper;

    @Override
    public
    int insert(ActivityContent activityContent){
        return activityContentMapper.insert(activityContent);
    }


    @Override
    public
    int delete(String activityContentCode){
        return activityContentMapper.delete(activityContentCode);
    }


    @Override
    public
    int update(ActivityContent activityContent){
        return activityContentMapper.update(activityContent);
    }

    @Override
    public
    ActivityContent getByActivityContentCode(String activityContentCode){
        return activityContentMapper.getByActivityContentCode(activityContentCode);
    }

    @Override
    public
    List<ActivityContent> ListByActivityItemCode(String activityItemCode){
        return activityContentMapper.ListByActivityItemCode(activityItemCode);
    }


    @Override
    public
    PageInfo<ActivityContent> pageByCommandCenterCode(int pageIndex, int pageSize,
                                                   String commandCenterCode,
                                                   String activityTypeCode,
                                                   String activityItemCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityContent> complaintList =activityContentMapper.listByCommandCenterCode(commandCenterCode,
                activityTypeCode,activityItemCode);
        return new PageInfo<>(complaintList);
    }


}
